import request from '@/utils/request'

// 管理员后台api
export default {
  getUserById(id) {
    return request({
      url: `/weddingadmin/user/getUserById/${id}`,
      method: 'GET',
    })
  },

  deleteAllSelect(ids) {
    return request({
        url: `/weddingadmin/user/deleteAllSelect`,
        method: 'delete',
        data: ids
    })
  },

  forbidUser(id) {
    return request({
      url: `/weddingadmin/user/forbidUser/${id}`,
      method: 'POST',
    })
  },

  releaseUser(id) {
    return request({
      url: `/weddingadmin/user/releaseUser/${id}`,
      method: 'POST',
    })
  },

  getUserPageVo(current, limit) {
    return request({
      url: `/weddingadmin/user/getUserPageVo/${current}/${limit}`,
      method: 'get',
    })
  },

  getUserPageQueryVo(current, limit, userQuery){
    return request({
        url: `/weddingadmin/user/getUserPageQueryVo/${current}/${limit}`,
        method: 'post',
        data: userQuery  //转化json传递
      })
  },
}

export function login(data) {
  return request({
    url: '/weddingadmin/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/weddingadmin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/weddingadmin/user/logout',
    method: 'post'
  })
}
